package com.example.demo;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;

@Route(path = "/app/MainActivity",group = "app")
public class MainActivity extends AppCompatActivity {
    Button btnLogin;
    Button btnMine;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        setEvent();
    }
    //初始化控件
    public void initView(){
        btnLogin=findViewById(R.id.btnLogin);
        btnMine=findViewById(R.id.btnMine);
    }
    //设置监听事件
    public void setEvent(){
        btnLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(MainActivity.this, "跳转到登录界面", Toast.LENGTH_SHORT).show();
                ARouter.getInstance().build("/login/LoginActivity").navigation();
            }
        });

        btnMine.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(MainActivity.this, "跳转到我的界面", Toast.LENGTH_SHORT).show();
                ARouter.getInstance().build("/mine/MineActivity").navigation();
            }
        });
    }
}
